##
## Makefile
##  
## Made by Michael DuPont
## Login   <mdupontmdupontdesktop2>
##
## Started on  Sat Feb 14 09:42:37 2009 Michael DuPont
## Last update Sat Feb 14 09:42:37 2009 Michael DuPont
## 
##############################
# Complete this to make it ! #
##############################
NAME 	=		# Name of executable file
SRC	=		# List of *.c
INCL  	=		# List of *.h
################
# Optional add #
################
IPATH   = -I.           # path of include file
OBJOPT  = -O2 -Wall -Wstrict-prototypes       # option for obj
EXEOPT  = -O2 -Wall -Wstrict-prototypes       # option for exe (-lefence ...)
LPATH   = -L.           # path for librairies ... 

#####################
# Macro Definitions #
#####################
CC 	= cc
MAKE 	= make
SHELL	= /bin/sh
OBJS 	= $(SRC:.c=.o) 
RM 	= /bin/rm -f 	
COMP	= gzip -9v
UNCOMP	= gzip -df
STRIP	= strip

CFLAGS  = $(OBJOPT) $(IPATH)
LDFLAGS = $(EXEOPT) $(LPATH)

.SUFFIXES: .h.Z .c.Z .h.gz .c.gz .c.z .h.z 

##############################
# Basic Compile Instructions #
##############################

all:	$(NAME)
$(NAME): $(OBJS) $(SRC) $(INCL)  
	$(CC) $(OBJS) $(LDFLAGS) -o $(NAME) 
#	$(STRIP) ./$(NAME) # if you debug ,don't strip ...

depend:
	gcc $(IPATH) -MM $(SRC) 
clean:
	-$(RM) $(NAME) $(OBJS) *~
fclean:
	-$(RM) $(NAME)
comp: clean
	$(COMP) $(INCL) $(SRC)
ucomp: 
	$(UNCOMP) $(SRC) $(INCL)

.c.Z.c .h.Z.h .c.gz.c .h.gz.h .c.z.c .h.z.h :
	 -$(UNCOMP) $<

.c.o:
	$(CC) $(CFLAGS) -c $< 
################
# Dependencies #
################

all : report.txt Parser.php.out.xml
	echo done
	
report.txt: getstruct.pl
	perl getstruct.pl structure.txt  > report.txt
	
newtemplates-inc.xsl:report.txt
	cat report.txt  > newtemplates-inc.xsl


Parser.php.out.xml : newtemplates-inc.xsl  phc_xml_test.xsl
	xsltproc --verbose phc_xml_test.xsl ../Parser.php.xml > Parser.php.out.xml 2> Parser.php.out2.xml




paths.txt :
	perl -e 's/^\s+//g' -pn Parser.php.out.xml | grep path | sort -u > paths.txt 


Method_invocation.txt:
	perl -p -e's/.+Method_invocation/Method_invocation/g' paths.txt  | grep Method_invocation | sort -u > sub_trees.Method_invocation.txt




Parser.php.out2.xml: phc_xml_test2.xsl 
	xsltproc phc_xml_test2.xsl ../Parser.php.xml > Parser.php.out2.xml





# aws rdf
Parser.php.rdf.xml:
	 xsltproc	 aws.xsl ../Parser.php.xml  > Parser.php.rdf.xml

Parser.php.rdf.xml.report.txt : Parser.php.rdf.xml
	bash ./extract2.sh Parser.php.rdf.xml

Parser.php.rdf.xml.report.txt2 :Parser.php.rdf.xml.structure.txt
	perl getstruct.pl Parser.php.rdf.xml.structure.txt  > Parser.php.rdf.xml.report.txt

Parser.php.rdf.xml.report.xsl: Parser.php.rdf.xml.report.txt
	cp Parser.php.rdf.xml.report.txt Parser.php.rdf.xml.report.xsl

Methods.xml :Methods.xsl ../Parser.php.xml
	xsltproc Methods.xsl ../Parser.php.xml  > Methods.xml 
	grep  -B1 path Methods.xml  | grep name | sort -u
